(* stack.pp *)

unit queue;

interface

const
   QUEUE_SIZE = 256;
	      
type 
   item	= record
	     imie     : ShortString;
	     nazwisko : ShortString;
	  end;	     
	
var 
   head, tail : integer;
   q	      : array[1..QUEUE_SIZE] of item;
	
procedure put(x : item);
function get() : item;
   
implementation
   
   procedure put(x : item ); 
begin
  if tail = QUEUE_SIZE then
     begin
	writeln('error: queue overflow!');
	exit;
     end
     else
     begin
	q[tail] := x;
	tail := tail+1;
     end;
end;

function get() : item; 
begin
  if head = tail then
     begin
    writeln('error: queue underflow!\n');
    exit;
     end
     else
     begin
	get:= q[head];
	head := head+1;
     end;
end; { get }

end.
